const express = require('express')
const app = express();
const port = 2233

app.all('*', function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "X-Requested-With");
  res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
  res.header("X-Powered-By",' 3.2.1')
  res.header("Content-Type", "application/json;charset=utf-8");
  next();
});

const userInfo = [
  {
    id: 131,
    name: 'wgf',
    age: 18
  }, {
    id: 154,
    name: 'lly',
    age: 16
  }, {
    id: 443,
    name: 'asd',
    age: 24
  }
]

app.get('/getUser', (req, res) => {
  res.send(JSON.stringify(userInfo))
})

app.get('/', (req, res) => {
  res.send('Hello')
})

app.listen(port, () => {
  console.log('Server Open ' + port)
})